<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 机器人管理</title>
    <link href="./js/bootstrap.min.css" rel="stylesheet">
    <link href="./js/bootstrap-icons.css" rel="stylesheet">


    <link rel="stylesheet" href="css/index.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: #f8fafc;
        }

        /* 顶部导航栏 */
        .top-nav {
            height: 60px;
            background-color: #2563eb;
            color: white;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 20px;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
        }

        .logo {
            font-size: 20px;
            font-weight: bold;
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        /* 主体布局 */
        .main-container {
            display: flex;
            margin-top: 60px;
            height: calc(100vh - 60px);
        }

        /* 左侧菜单栏 */
        .sidebar {
            width: 220px;
            background-color: #1e293b;
            color: white;
            height: 100%;
            position: fixed;
            overflow-y: auto;
            transition: all 0.3s;
        }

        .sidebar.collapsed {
            width: 80px;
        }

        .menu-toggle {
            padding: 15px 20px;
            cursor: pointer;
            border-bottom: 1px solid #334155;
        }

        .menu-items {
            padding: 10px 0;
        }

        .menu-item {
            padding: 12px 20px;
            display: flex;
            align-items: center;
            gap: 12px;
            cursor: pointer;
            transition: background 0.2s;
        }

        .menu-item:hover {
            background-color: #334155;
        }

        .menu-item.active {
            background-color: #2563eb;
        }

        .menu-text {
            white-space: nowrap;
            overflow: hidden;
        }

        .sidebar.collapsed .menu-text {
            display: none;
        }

        .sidebar.collapsed .menu-item {
            justify-content: center;
        }

        /* 内容区 */
        .content {
            flex: 1;
            margin-left: 220px;
            padding: 20px;
            transition: margin-left 0.3s;
        }

        .sidebar.collapsed ~ .content {
            margin-left: 80px;
        }

        /* 面包屑导航 */
        .breadcrumb-nav {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
        }

        /* 卡片样式 */
        .card {
            background: white;
            border-radius: 8px;
            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
            padding: 20px;
            margin-bottom: 20px;
        }

        .card-title {
            font-size: 18px;
            font-weight: 600;
            color: #1e293b;
            margin-bottom: 20px;
        }

        /* 表格样式 */
        .table-container {
            overflow-x: auto;
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th, td {
            padding: 12px;
            text-align: left;
            border-bottom: 1px solid #e2e8f0;
        }

        th {
            background-color: #f1f5f9;
            font-weight: 600;
            color: #1e293b;
        }

        tr:hover {
            background-color: #f8fafc;
        }

        /* 按钮样式 */
        .btn {
            padding: 6px 12px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 12px;
            border: none;
            margin: 2px;
        }

        .btn-primary {
            background-color: #2563eb;
            color: white;
        }

        .btn-success {
            background-color: #10b981;
            color: white;
        }

        .btn-warning {
            background-color: #f59e0b;
            color: white;
        }

        .btn-danger {
            background-color: #ef4444;
            color: white;
        }

        .btn-outline {
            background-color: transparent;
            border: 1px solid #cbd5e1;
            color: #64748b;
        }

        .btn-sm {
            padding: 4px 8px;
            font-size: 11px;
        }

        /* 筛选器 */
        .filter-row {
            display: flex;
            gap: 15px;
            align-items: end;
            flex-wrap: wrap;
        }

        .filter-item {
            flex: 1;
            min-width: 150px;
        }

        .filter-item label {
            display: block;
            margin-bottom: 5px;
            font-weight: 500;
        }

        .filter-item input,
        .filter-item select {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #cbd5e1;
            border-radius: 4px;
        }

        /* 状态统计卡片 */
        .status-stats {
            display: flex;
            gap: 20px;
            flex-wrap: wrap;
        }

        .status-card {
            flex: 1;
            min-width: 200px;
            padding: 15px;
            border-radius: 8px;
            text-align: center;
            color: white;
        }

        .status-online {
            background-color: #10b981;
        }

        .status-offline {
            background-color: #f59e0b;
        }

        .status-fault {
            background-color: #ef4444;
        }

        .status-total {
            background-color: #64748b;
        }

        .status-label {
            font-size: 14px;
            margin-bottom: 5px;
        }

        .status-value {
            font-size: 24px;
            font-weight: bold;
        }

        /* 状态指示器 */
        .status-indicator {
            display: inline-flex;
            align-items: center;
            gap: 5px;
        }

        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            display: inline-block;
        }

        .status-dot.online {
            background-color: #10b981;
        }

        .status-dot.offline {
            background-color: #f59e0b;
        }

        .status-dot.fault {
            background-color: #ef4444;
        }

        .status-dot.maintenance {
            background-color: #8b5cf6;
        }

        /* 表单布局 */
        .form-row {
            display: flex;
            gap: 20px;
            margin-bottom: 20px;
        }

        .form-col {
            flex: 1;
        }

        .form-group {
            margin-bottom: 15px;
        }

        .form-group label {
            display: block;
            margin-bottom: 5px;
            font-weight: 500;
        }

        .form-group input,
        .form-group select,
        .form-group textarea {
            width: 100%;
            padding: 8px 12px;
            border: 1px solid #cbd5e1;
            border-radius: 4px;
        }

        /* 弹窗样式 */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.5);
            z-index: 2000;
            align-items: center;
            justify-content: center;
        }

        .modal.show {
            display: flex;
        }

        .modal-content {
            background: white;
            border-radius: 8px;
            width: 600px;
            max-width: 90%;
            max-height: 90%;
            overflow-y: auto;
        }

        .modal-header {
            padding: 20px;
            border-bottom: 1px solid #e2e8f0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .modal-body {
            padding: 20px;
        }

        .modal-footer {
            padding: 20px;
            border-top: 1px solid #e2e8f0;
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }

        .close {
            font-size: 24px;
            cursor: pointer;
        }

        /* Tooltip */
        .tooltip {
            position: relative;
            display: inline-block;
        }

        .tooltip .tooltiptext {
            visibility: hidden;
            width: 200px;
            background-color: #333;
            color: white;
            text-align: center;
            border-radius: 6px;
            padding: 8px;
            position: absolute;
            z-index: 1;
            bottom: 125%;
            left: 50%;
            margin-left: -100px;
            opacity: 0;
            transition: opacity 0.3s;
            font-size: 12px;
        }

        .tooltip:hover .tooltiptext {
            visibility: visible;
            opacity: 1;
        }

        /* 响应式 */
        @media (max-width: 768px) {
            .form-row {
                flex-direction: column;
            }
            
            .filter-row {
                flex-direction: column;
            }
            
            .filter-item {
                min-width: 100%;
            }
            
            .status-stats {
                flex-direction: column;
            }
        }
    </style>
</head>
<body>
    <!-- 顶部导航栏 -->
    <div class="top-nav">
        <div class="logo">管理系统</div>
        <div class="user-info">
            <div class="notification-icon">🔔</div>
            <div class="user-dropdown">
                <span>管理员 ▼</span>
            </div>
        </div>
    </div>

    <!-- 主体布局 -->
    <div class="main-container">
        <!-- 左侧菜单栏 -->
        <div class="sidebar" id="sidebar">
            <div class="menu-toggle" onclick="toggleSidebar()">☰ 菜单</div>
            <div class="menu-items">
                <div class="menu-item">
                    <a href="./index.html">
                        <span>📊</span>
                        <span class="menu-text">仪表盘</span>
                    </a>
                  
                </div>
                <div class="menu-item">
                    <a href="./dianpu.html">
                        <span>🏪</span>
                        <span class="menu-text">店铺管理</span>
                    </a>
                   
                </div>
                <div class="menu-item active">
                    <a href="./jiqiren.html">
                        <span>🤖</span>
                        <span class="menu-text">机器人管理</span>
                    </a>
                 
                </div>
                <div class="menu-item">
                    <a href="./order.html">
                        <span>📋</span>
                        <span class="menu-text">订单管理</span>
                    </a>
                   
                </div>
                <div class="menu-item ">
                    <span>👥</span>
                    <span class="menu-text">用户会员管理</span>
                    <span>▶</span>
                </div>
                <div class="submenu">
                    <div class="submenu-item">
                        <a href="./user.html">
                            <span>├─</span>
                            <span class="menu-text">用户会员列表</span>
                        </a>
                      
                    </div>
                    <div class="submenu-item ">
                        <a href="./vip.html">
                            <span>├─</span>
                            <span class="menu-text">会员等级配置</span>
                        </a>
                        
                    </div>
                </div>
                <div class="menu-item ">
                    <a href="./fuwu.html">
                        <span>🎯</span>
                        <span class="menu-text">服务套餐类型</span>
                    </a>
                </div>
                <div class="menu-item">
                    <span>🎯</span>
                    <span class="menu-text">促销管理(二期)</span>
                </div>
                <div class="menu-item">
                    <span>📈</span>
                    <span class="menu-text">数据统计(二期)</span>
                </div>
                <div class="menu-item">
                    <span>⚙️</span>
                    <span class="menu-text">系统设置</span>
                </div>
            </div>
        </div>

        <!-- 中间内容区 -->
        <div class="content">
            <!-- 机器人列表页 -->
            <div id="robotListPage">
                <!-- 面包屑导航 -->
                <div class="breadcrumb-nav">
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item">机器人管理</li>
                            <li class="breadcrumb-item active">机器人列表</li>
                        </ol>
                    </nav>
                    <button class="btn btn-primary" onclick="showAddRobotForm()">
                        <i class="bi bi-plus-lg"></i> 新增机器人
                    </button>
                </div>

                <!-- 筛选器 -->
                <div class="card">
                    <div class="card-title">筛选条件</div>
                    <div class="filter-row">
                        <div class="filter-item">
                            <label>机器人编号</label>
                            <input type="text" placeholder="请输入机器人编号">
                        </div>
                        <div class="filter-item">
                            <label>状态</label>
                            <select>
                                <option value="">全部</option>
                                <option value="在线">在线</option>
                                <option value="离线">离线</option>
                                <option value="故障">故障</option>
                                <option value="维护中">维护中</option>
                            </select>
                        </div>
                        <div class="filter-item">
                            <label>所属店铺</label>
                            <select>
                                <option value="">全部</option>
                                <option value="朝阳店">朝阳店</option>
                                <option value="海淀店">海淀店</option>
                                <option value="丰台店">丰台店</option>
                            </select>
                        </div>
                        <div class="filter-item">
                            <button class="btn btn-primary">搜索</button>
                            <button class="btn btn-outline" style="margin-left: 10px;">重置</button>
                        </div>
                    </div>
                </div>

                <!-- 状态统计卡片 -->
                <div class="status-stats">
                    <div class="status-card status-online">
                        <div class="status-label">在线</div>
                        <div class="status-value">186台</div>
                    </div>
                    <div class="status-card status-offline">
                        <div class="status-label">离线</div>
                        <div class="status-value">24台</div>
                    </div>
                    <div class="status-card status-fault">
                        <div class="status-label">故障</div>
                        <div class="status-value">5台</div>
                    </div>
                    <div class="status-card status-total">
                        <div class="status-label">总计</div>
                        <div class="status-value">215台</div>
                    </div>
                </div>

                <!-- 机器人表格 -->
                <div class="card">
                    <div class="table-container">
                        <table>
                            <thead>
                                <tr>
                                    <th><input type="checkbox"></th>
                                    <th>编号</th>
                                    <th>型号</th>
                                    <th>所属店铺</th>
                                    <th>状态</th>
                                    <th>运行时长</th>
                                    <th>上次维护</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td><input type="checkbox"></td>
                                    <td>R001</td>
                                    <td>智能款</td>
                                    <td>朝阳店</td>
                                    <td>
                                        <div class="tooltip">
                                            <span class="status-indicator">
                                                <span class="status-dot online"></span>
                                                在线
                                            </span>
                                            <span class="tooltiptext">运行正常</span>
                                        </div>
                                    </td>
                                    <td>1200h</td>
                                    <td>2024-10-01</td>
                                    <td>
                                        <button class="btn btn-outline btn-sm" onclick="showEditRobotForm('R001')">编辑</button>
                                        <button class="btn btn-warning btn-sm">解绑</button>
                                        <button class="btn btn-outline btn-sm" onclick="showMaintenanceRecords('R001')">维护记录</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td><input type="checkbox"></td>
                                    <td>R002</td>
                                    <td>基础款</td>
                                    <td>海淀店</td>
                                    <td>
                                        <div class="tooltip">
                                            <span class="status-indicator">
                                                <span class="status-dot offline"></span>
                                                离线
                                            </span>
                                            <span class="tooltiptext">离线原因：网络断开</span>
                                        </div>
                                    </td>
                                    <td>850h</td>
                                    <td>2024-09-25</td>
                                    <td>
                                        <button class="btn btn-outline btn-sm" onclick="showEditRobotForm('R002')">编辑</button>
                                        <button class="btn btn-warning btn-sm">解绑</button>
                                        <button class="btn btn-outline btn-sm" onclick="showMaintenanceRecords('R002')">维护记录</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td><input type="checkbox"></td>
                                    <td>R003</td>
                                    <td>智能款</td>
                                    <td>丰台店</td>
                                    <td>
                                        <div class="tooltip">
                                            <span class="status-indicator">
                                                <span class="status-dot fault"></span>
                                                故障
                                            </span>
                                            <span class="tooltiptext">故障原因：电机故障</span>
                                        </div>
                                    </td>
                                    <td>920h</td>
                                    <td>2024-09-30</td>
                                    <td>
                                        <button class="btn btn-outline btn-sm" onclick="showEditRobotForm('R003')">编辑</button>
                                        <button class="btn btn-warning btn-sm">解绑</button>
                                        <button class="btn btn-danger btn-sm" onclick="showFaultForm('R003')">处理故障</button>
                                    </td>
                                </tr>
                                <tr>
                                    <td><input type="checkbox"></td>
                                    <td>R004</td>
                                    <td>智能款</td>
                                    <td>朝阳店</td>
                                    <td>
                                        <div class="tooltip">
                                            <span class="status-indicator">
                                                <span class="status-dot maintenance"></span>
                                                维护中
                                            </span>
                                            <span class="tooltiptext">正在维护</span>
                                        </div>
                                    </td>
                                    <td>780h</td>
                                    <td>2024-10-05</td>
                                    <td>
                                        <button class="btn btn-outline btn-sm" onclick="showEditRobotForm('R004')">编辑</button>
                                        <button class="btn btn-warning btn-sm">解绑</button>
                                        <button class="btn btn-outline btn-sm" onclick="showMaintenanceRecords('R004')">维护记录</button>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

            <!-- 机器人编辑/新增页 -->
            <div id="robotFormPage" style="display: none;">
                <!-- 面包屑导航 -->
                <div class="breadcrumb-nav">
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item">机器人管理</li>
                            <li class="breadcrumb-item active" id="formTitle">新增机器人</li>
                        </ol>
                    </nav>
                    <div>
                        <button class="btn btn-primary" onclick="saveRobot()">保存</button>
                        <button class="btn btn-outline" onclick="showRobotList()" style="margin-left: 10px;">取消</button>
                    </div>
                </div>

                <!-- 基础信息表单 -->
                <div class="card">
                    <div class="card-title">基础信息</div>
                    <div class="form-row">
                        <div class="form-col">
                            <div class="form-group">
                                <label>机器人编号 *</label>
                                <input type="text" id="robotId" placeholder="请输入机器人编号">
                            </div>
                            <div class="form-group">
                                <label>型号 *</label>
                                <select id="robotModel">
                                    <option value="">请选择型号</option>
                                    <option value="基础款">基础款</option>
                                    <option value="智能款">智能款</option>
                                    <option value="豪华款">豪华款</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>生产日期 *</label>
                                <input type="date" id="productionDate">
                            </div>
                        </div>
                        <div class="form-col">
                            <div class="form-group">
                                <label>所属店铺 *</label>
                                <select id="storeId">
                                    <option value="">请选择店铺</option>
                                    <option value="朝阳店">朝阳店</option>
                                    <option value="海淀店">海淀店</option>
                                    <option value="丰台店">丰台店</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>状态</label>
                                <select id="robotStatus">
                                    <option value="在线">在线</option>
                                    <option value="离线">离线</option>
                                    <option value="故障">故障</option>
                                    <option value="维护中">维护中</option>
                                </select>
                            </div>
                            <div class="form-group">
                                <label>备注</label>
                                <textarea id="robotNote" rows="3" placeholder="请输入备注信息"></textarea>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 技术参数 -->
                <div class="card">
                    <div class="card-title">技术参数</div>
                    <div class="form-row">
                        <div class="form-col">
                            <div class="form-group">
                                <label>最大功率 (W)</label>
                                <input type="number" id="maxPower" placeholder="请输入最大功率">
                            </div>
                            <div class="form-group">
                                <label>工作电压 (V)</label>
                                <input type="number" id="voltage" placeholder="请输入工作电压">
                            </div>
                        </div>
                        <div class="form-col">
                            <div class="form-group">
                                <label>水箱容量 (L)</label>
                                <input type="number" id="waterCapacity" placeholder="请输入水箱容量" step="0.1">
                            </div>
                            <div class="form-group">
                                <label>重量 (kg)</label>
                                <input type="number" id="weight" placeholder="请输入重量" step="0.1">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 故障处理表单 -->
    <div class="modal" id="faultModal">
        <div class="modal-content">
            <div class="modal-header">
                <h5>故障处理</h5>
                <span class="close" onclick="closeFaultModal()">&times;</span>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label>机器人编号</label>
                    <input type="text" id="faultRobotId" readonly>
                </div>
                <div class="form-group">
                    <label>故障原因 *</label>
                    <textarea id="faultReason" rows="3" placeholder="请输入故障原因"></textarea>
                </div>
                <div class="form-group">
                    <label>处理方案 *</label>
                    <textarea id="faultSolution" rows="3" placeholder="请输入处理方案"></textarea>
                </div>
                <div class="form-group">
                    <label>处理人 *</label>
                    <input type="text" id="faultHandler" placeholder="请输入处理人姓名">
                </div>
                <div class="form-group">
                    <label>预计完成时间</label>
                    <input type="datetime-local" id="expectedCompletion">
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-outline" onclick="closeFaultModal()">取消</button>
                <button class="btn btn-primary" onclick="submitFaultForm()">提交</button>
            </div>
        </div>
    </div>

    <!-- 维护记录页面 -->
    <div class="modal" id="maintenanceModal">
        <div class="modal-content" style="width: 800px;">
            <div class="modal-header">
                <h5>维护记录 - <span id="maintenanceRobotId"></span></h5>
                <span class="close" onclick="closeMaintenanceModal()">&times;</span>
            </div>
            <div class="modal-body">
                <div class="table-container">
                    <table>
                        <thead>
                            <tr>
                                <th>时间</th>
                                <th>维护类型</th>
                                <th>内容</th>
                                <th>处理人</th>
                                <th>状态</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>2024-10-01 14:30</td>
                                <td>定期维护</td>
                                <td>更换滤芯，清洁水箱</td>
                                <td>张师傅</td>
                                <td><span class="badge bg-success">已完成</span></td>
                            </tr>
                            <tr>
                                <td>2024-09-15 10:15</td>
                                <td>故障维修</td>
                                <td>电机故障维修</td>
                                <td>李师傅</td>
                                <td><span class="badge bg-success">已完成</span></td>
                            </tr>
                            <tr>
                                <td>2024-08-20 09:45</td>
                                <td>定期维护</td>
                                <td>全面清洁，检查电路</td>
                                <td>王师傅</td>
                                <td><span class="badge bg-success">已完成</span></td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div style="margin-top: 20px; text-align: center;">
                    <button class="btn btn-primary" onclick="addMaintenanceRecord()">
                        <i class="bi bi-plus-lg"></i> 新增维护记录
                    </button>
                </div>
            </div>
            <div class="modal-footer">
                <button class="btn btn-outline" onclick="closeMaintenanceModal()">关闭</button>
            </div>
        </div>
    </div>

    <script>
        // 切换侧边栏
        function toggleSidebar() {
            const sidebar = document.getElementById('sidebar');
            sidebar.classList.toggle('collapsed');
        }

        // 显示新增机器人表单
        function showAddRobotForm() {
            document.getElementById('robotListPage').style.display = 'none';
            document.getElementById('robotFormPage').style.display = 'block';
            document.getElementById('formTitle').textContent = '新增机器人';
            
            // 清空表单
            document.getElementById('robotId').value = '';
            document.getElementById('robotModel').value = '';
            document.getElementById('productionDate').value = '';
            document.getElementById('storeId').value = '';
            document.getElementById('robotStatus').value = '在线';
            document.getElementById('robotNote').value = '';
            document.getElementById('maxPower').value = '';
            document.getElementById('voltage').value = '';
            document.getElementById('waterCapacity').value = '';
            document.getElementById('weight').value = '';
        }

        // 显示编辑机器人表单
        function showEditRobotForm(robotId) {
            document.getElementById('robotListPage').style.display = 'none';
            document.getElementById('robotFormPage').style.display = 'block';
            document.getElementById('formTitle').textContent = '编辑机器人';
            
            // 模拟填充表单数据
            document.getElementById('robotId').value = robotId;
            document.getElementById('robotModel').value = '智能款';
            document.getElementById('productionDate').value = '2024-01-15';
            document.getElementById('storeId').value = '朝阳店';
            document.getElementById('robotStatus').value = '在线';
            document.getElementById('robotNote').value = '正常使用';
            document.getElementById('maxPower').value = '1200';
            document.getElementById('voltage').value = '220';
            document.getElementById('waterCapacity').value = '2.5';
            document.getElementById('weight').value = '45.5';
        }

        // 返回机器人列表
        function showRobotList() {
            document.getElementById('robotFormPage').style.display = 'none';
            document.getElementById('robotListPage').style.display = 'block';
        }

        // 保存机器人
        function saveRobot() {
            const robotId = document.getElementById('robotId').value;
            if (!robotId) {
                alert('请输入机器人编号');
                return;
            }
            alert('机器人信息已保存');
            showRobotList();
        }

        // 显示故障处理表单
        function showFaultForm(robotId) {
            document.getElementById('faultRobotId').value = robotId;
            document.getElementById('faultModal').classList.add('show');
        }

        // 关闭故障处理表单
        function closeFaultModal() {
            document.getElementById('faultModal').classList.remove('show');
        }

        // 提交故障处理表单
        function submitFaultForm() {
            const reason = document.getElementById('faultReason').value;
            const solution = document.getElementById('faultSolution').value;
            const handler = document.getElementById('faultHandler').value;
            
            if (!reason || !solution || !handler) {
                alert('请填写必填项');
                return;
            }
            
            alert('故障处理信息已提交，状态更新为"维护中"');
            closeFaultModal();
        }

        // 显示维护记录
        function showMaintenanceRecords(robotId) {
            document.getElementById('maintenanceRobotId').textContent = robotId;
            document.getElementById('maintenanceModal').classList.add('show');
        }

        // 关闭维护记录
        function closeMaintenanceModal() {
            document.getElementById('maintenanceModal').classList.remove('show');
        }

        // 新增维护记录
        function addMaintenanceRecord() {
            alert('新增维护记录功能');
        }

        // 菜单点击事件
        document.querySelectorAll('.menu-item').forEach(item => {
            item.addEventListener('click', function() {
                document.querySelectorAll('.menu-item').forEach(i => i.classList.remove('active'));
                this.classList.add('active');
            });
        });
    </script>
</body>
</html>